<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>v-on参数传递</title>
</head>
<body>
    <div id="app">
        {{count}}
        <!-- 情况一:不传参,但是函数接收了一个参数 -->
        <button @click="add">+</button>
        <!-- 情况二:使用$event传event对象到回调函数 -->
        <button @click="decrement($event,123)">-</button>
    </div>

    <script src="../vue/vue.js"></script>
    <script>
        const app = new Vue({
            el:'#app',
            data:{
                count:0
            },
            methods: {
                add(event){
                    //情况一:打印event对象,vue默认传入
                    console.log(event);
                },
                decrement(event,num){
                    //情况二:设置监听的时候,传入$event,则会把event对象传到这
                    console.log(event,num);
                }
            },
        });
    </script>
</body>
</html>